package com.dmatek.uwb.xml.util.iparse.bean;

import com.dmatek.uwb.xml.dom.bean.BaseNode;
import com.dmatek.uwb.xml.dom.bean.BranchNode;
import com.dmatek.uwb.xml.dom.bean.MainNode;
import com.dmatek.uwb.xml.util.iassign.IAssignAttributeTool;
/***
 * Node解析实现类
 * @author zhangfu
 * @data 2019年6月22日 下午3:22:19
 * @Description
 */
public class NodeParse extends BaseDomParse<BaseNode> {
	public NodeParse(IAssignAttributeTool iAssignTool) {
		super(iAssignTool);
	}
	@Override
	public boolean isMatch(String clazzName) throws Exception {
		if(MainNode.DOM_NAME.equalsIgnoreCase(clazzName) 
			|| BranchNode.DOM_NAME.equalsIgnoreCase(clazzName)) {
			return true;
		}
		return false;
	}
	@Override
	protected BaseNode createEmpty(String className) {
		if(MainNode.DOM_NAME.equalsIgnoreCase(className)) {
			return new MainNode();
		} else if(BranchNode.DOM_NAME.equalsIgnoreCase(className)) {
			return new BranchNode();
		}
		return null;
	}

}
